Macros

Declare SQL to be included in generated extension script.

Declare SQL (from a file) to be included in generated extension script.

Attribute Macros

Used with #[pg_operator]. 1 value which is the function name

Used with #[pg_operator]. no values

Associated macro for #[pg_test] to provide context back to your test framework to indicate that the test system is being initialized

Used with #[pg_operator]. 1 value which is the function name

Used with #[pg_operator]. no values

Used with #[pg_operator]. 1 value which is the function name

Used with #[pg_operator]. 1 value which is the operator name itself

Declare a pgx::Aggregate implentation on a type as able to used by Postgres as an aggregate.

Declare a function as #[pg_extern] to indicate that it can be used by Postgres as a UDF.

Declare a function as #[pg_guard] to indicate that it is called from a Postgres extern "C" function so that Rust panic!()s (and Postgres elog(ERROR)s) will be properly handled by pgx

Declare a function as #[pg_operator] to indicate that it represents a Postgres operator cargo pgx schema will automatically generate the underlying SQL

Declare a Rust module and its contents to be in a schema.

#[pg_test] functions are test functions (akin to #[test]), but they run in-process inside Postgres during cargo pgx test.

A helper attribute for various contexts.

Used with #[pg_operator]. 1 value which is the function name

Associated macro for #[pg_extern] or #[macro@pg_operator]. Used to set the SEARCH_PATH option on the CREATE FUNCTION statement.

Derive Macros

Generate necessary bindings for using the enum with PostgreSQL.

Generate necessary code using the type in operators like == and !=.

Generate necessary code for stable hashing the type so it can be used with USING hash indexes.

Generate necessary code using the type in operators like >, <, <=, and >=.

Generate necessary bindings for using the type with PostgreSQL.